package com.template.ejb.rest;

import java.lang.reflect.InvocationTargetException;

import javax.ejb.Local;
import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import com.template.ejb.domain.Person;
import com.template.ejb.rest.dto.PersonDTO;
import com.template.ejb.rest.dto.PersonListDTO;

/**
 * 
 * 
 */
@Local
@Path("/person")
@Produces("application/json")
@Consumes("application/json")
public interface UserResource {

	@POST
	@Path("/create")
	public PersonDTO create(PersonDTO personDTO) throws IllegalAccessException,
			InvocationTargetException;

	@PUT
	@Path("/update")
	public Person update(PersonDTO personDTO) throws IllegalAccessException,
			InvocationTargetException;

	@GET
	@Path("/find/{id}")
	public Person findById(@PathParam("id") Long id);

	@GET
	@Path("/findbylogin/{login}")
	public Person findByLogin(@PathParam("login") String login);

	@GET
	@Path("/persons")
	public PersonListDTO getPersons(
			@QueryParam("offset") @DefaultValue("0") int offset,
			@QueryParam("limit") @DefaultValue("10") int limit)
			throws IllegalAccessException, InvocationTargetException;

}
